package com.tyoj.tyojbackendjudgeservice.codesanbox;

import com.tyoj.tyojbackendjudgeservice.codesanbox.impl.ThidPartyCodeSandbox;
import com.tyoj.tyojbackendjudgeservice.codesanbox.impl.ExamplCodeSandbox;
import com.tyoj.tyojbackendjudgeservice.codesanbox.impl.RemoteCodeSandbox;
import com.tyoj.tyojbackendjudgeservice.codesanbox.mode.enums.SandBoxTypeEnum;

/**
 * 代码沙箱工厂(根据字符长参数创建指定的代码沙箱)
 */
public class CodeSandboxFactory {

    public static CodeSandbox newInstance(String type) {
        if (SandBoxTypeEnum.EXAMPLE.getValue().equals(type)) {
            return new ExamplCodeSandbox();
        } else if (SandBoxTypeEnum.REMOTE.getValue().equals(type)) {
            return new RemoteCodeSandbox();
        }
        return new ThidPartyCodeSandbox();
    }
}
